import axios from "axios";

export default {
  state: {},
  getters: {},
  mutations: {},
  actions: {
    generateNotification(context, data) {
      let url = "/clue/notification/add";
      let postData = {
        year: data.year,
        provId: data.provId,
        clueId: data.clueId,
      };
      let config = {
        headers: {
          Authorization: "Bearer " + data.token,
        },
      };
      axios
        .post(url, postData, config)
        .then((resp) => {
          data.success(resp);
        })
        .catch((resp) => {
          data.error(resp);
        });
    },
    deleteNotificationById(context, data) {
      let url = "/clue/notification/delete/by/id";
      let postData = {
        id: data.id,
      };
      let config = {
        headers: {
          Authorization: "Bearer " + data.token,
        },
      };
      axios
        .post(url, postData, config)
        .then((resp) => {
          data.success(resp);
        })
        .catch((resp) => {
          data.error(resp);
        });
    },
    selectNotificationByCondition(context, data) {
      let url = "/clue/notification/select/by/condition";
      let postData = {
        year: data.year,
        provId: data.provId,
      };
      let config = {
        headers: {
          Authorization: "Bearer " + data.token,
        },
      };
      axios
        .post(url, postData, config)
        .then((resp) => {
          data.success(resp);
        })
        .catch((resp) => {
          data.error(resp);
        });
    },
  },
  modules: {},
};
